'''
Created on 30/set/2009

@author: syn
'''
import datetime

import os
import logging

# Log setup
LOG_FILE = os.sep.join([os.environ['HOME'], "pybookler.log"])
logger = logging.getLogger("pybookler")
logger.setLevel(logging.DEBUG) 
fh = logging.FileHandler(LOG_FILE, "w")
fh.setLevel(logging.NOTSET)
fh.setFormatter(logging.Formatter(
                "%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
logger.addHandler(fh)

# This logger is for client soap
SOAPLOG_FILE = os.sep.join([os.environ['HOME'], "soap.log"])
soaplogger = logging.getLogger("suds.client")
soaplogger.setLevel(logging.DEBUG)
sfh = logging.FileHandler(SOAPLOG_FILE, "w")
sfh.setLevel(logging.NOTSET)
sfh.setFormatter(logging.Formatter(
                "%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
soaplogger.addHandler(sfh)

class Environment():
    def __init__(self, user=None):
        self._logged_user = user
        self.start_time = datetime.datetime.now()
        
    def set_user(self, user):
        self._logged_user = user
        
    def get_user(self):
        return self._logged_user
    
envir = Environment()
        